<template>
    <div style="width: 100%;height:350px;"/>
</template>

<script>

export default {

    props: {
        title: String,
        data: Array
    },

    mounted() {
      this.init(this.data)
    },

    methods: {
        init(data) {
            let e1 = this.$echarts.init(this.$el)
            e1.setOption({
                title: {
                    text: this.title,
                    left: 'center',
                    align: 'right',
                    textStyle: {
                        color: '#00eeff',  // 图例文字的颜色
                    },
                },
                tooltip: {
                    trigger: 'item',
                    formatter: '{b} : {c}元 ({d}%)'
                },
                series: [
                    {
                        type: 'pie',
                        center: ['50%', '58%'],
                        data
                    }
                ]
            })
        }
    }
}
</script>
